[error] The chromium binary is not available for arm64: (puppeteer, nodejs)
케이 (3)2022년 4월 08일
Tags #mac#M1#javascript#arm64#nodejs

image

x86 환경에서 puppeteer를 통해서 작업하던 소스를 m1 맥으로 clone받아 npm install을 하면 아래와 같이 에러가 나는 경우가 있습니다.

npm WARN deprecated puppeteer@4.0.1: Version no longer supported. Upgrade to @latest
npm ERR! code 1
npm ERR! path /Users/********/*********/node_modules/puppeteer
npm ERR! command failed
npm ERR! command sh -c node install.js
npm ERR! The chromium binary is not available for arm64:
npm ERR! If you are on Ubuntu, you can install with:
npm ERR!
npm ERR!  apt-get install chromium-browser
npm ERR!
npm ERR! /Users/********/*********/node_modules/puppeteer/lib/BrowserFetcher.js:112
npm ERR!             throw new Error();
npm ERR!             ^
npm ERR!
npm ERR! Error
npm ERR!     at /Users/********/*********/node_modules/puppeteer/lib/BrowserFetcher.js:112:19
npm ERR!     at FSReqCallback.oncomplete (node:fs:198:21)

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/********/*********/.npm/_logs/2022-04-08T05_56_54_103Z-debug.log

brew 를 통해서 chromium을 install 해줍니다.

brew install chromium

설치가 잘 되었는지 확인합니다.

❯ which chromium
/opt/homebrew/bin/chromium

.zshrc에 아래 두 줄을 추가합니다.

export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
export PUPPETEER_EXECUTABLE_PATH=`which chromium`

다시 npm install하면 정상적으로 module이 설치가 완료됩니다.


0개의 댓글